package net.zoneland.zrdp.framework.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

public class DiscardWithLogPolicy implements RejectedExecutionHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(DiscardWithLogPolicy.class);

    @Override
    public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) {
        // 可以记录更多信息，比如线程池状态等
        LOGGER.error("--队列满了--Task rejected. Executor:{} ", executor);
    }
}
